<#assign module="sys"/>

<#macro padZero value>
    <#if value?length==1>
    0${value}
    <#else>
    ${value}
    </#if>
</#macro>

<@override name="header">
</@override>

<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					填写提成信息
					<button type="button" class="time-add pull-right button button-pill button-flat-action button-tiny"><span class="glyphicon glyphicon-plus"></span>&nbsp;新增时间段</button>
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/driverlevel/createTimeMoney" class="form-horizontal" method="post">
		              
		               <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>提成方式：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="typeSelect" required> 
		                    		<option value="${ctx}/driverlevel/add?type=0">简单模式</option>
									<option value="${ctx}/driverlevel/add?type=1" selected="selected">金额区间模式</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>名称：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="name" name="name" type="text" required/>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>提成时间点：</label>
		                    <div class="col-sm-3">
		                    	<select class="form-control" id="timePoint" name="timePoint" required> 
		                    		<option value="serviceTime">预约时间</option>
									<option value="startDrive" selected="selected">开始服务时间</option>
									<option value="finishTime">结算时间</option>
		                    	</select>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><font color="red">注：</font></label>
		                    <div class="col-sm-9">
		                    	<p class="form-control-static">固定提成 / 提成比例为公司所得提成，不使用固定提成或比例提成请设置为0；若工单实收金额小于填写的最低金额，则公司提成填写的固定金额，不使用请设置为0或不填。</p>
		                    </div>
		                </div>
		                
		                <div id="fieldset-div">
			                <fieldset data-name="driverLevelMoneyTimeDetails[0]">
								<legend>分时段1</legend>
								<small class="pull-right"></small>
				                <div class="form-group">
				                	<label class="col-sm-3 control-label"><em>*</em>时间：</label>
				                	<div class="col-sm-4">
				                		<select name="driverLevelMoneyTimeDetails[0].startHour" style="width:60px;vertical-align:middle;">
				                			<#list 0..23 as t>
												<option value="${t}"><@padZero t /></option>
											</#list>
				                		<select>
				                		<select name="driverLevelMoneyTimeDetails[0].startMinute" style="width:60px;vertical-align:middle;">
				                			<#list 0..59 as t>
												<option value="${t}"><@padZero t /></option>
											</#list>
				                		<select>
				                		至
				                		<select name="driverLevelMoneyTimeDetails[0].endHour" style="width:60px;vertical-align:middle;">
				                			<#list 0..23 as t>
				                				<#if t==23>
				                					<option value="${t}" selected="selected"><@padZero t /></option>
				                				<#else>
				                					<option value="${t}"><@padZero t /></option>
				                				</#if>
											</#list>
				                		<select>
				                		<select name="driverLevelMoneyTimeDetails[0].endMinute" style="width:60px;vertical-align:middle;">
				                			<#list 0..59 as t>
				                				<#if t==59>
				                					<option value="${t}" selected="selected"><@padZero t /></option>
				                				<#else>
				                					<option value="${t}"><@padZero t /></option>
				                				</#if>
											</#list>
				                		<select>
				                	</div>
				                </div>
				                
				                <div class="form-group">
				                    <label class="col-sm-3 control-label">
				                    	<button type="button" class="btn btn-default btn-xs add-money-area"><i class="glyphicon glyphicon-plus"></i> 添加</button>
				                    </label>
				                    
				                    <div class="col-sm-8 moneyConfig_div">
					                    <div class="input-group">
						                	<span class="input-group-addon">从</span>
							            	<input class="form-control fromMoney" type="number" min="0" value="0"/>
							            	<span class="input-group-addon">元到</span>
							            	<input class="form-control toMoney" type="number" min="0"/>
							            	<span class="input-group-addon">元，提成方式为</span>
							            	<select class="form-control driverLevelMoneyType" style="width:120px;">
							            		<option value="guding">固定提成</option>
							            		<option value="ticheng">比例提成</option>
							            	</select>
								            <span class="input-group-addon moneyUnit_span">每</span>
								            <input class="form-control moneyUnit" type="number" min="0"/>
							            	<span class="input-group-addon">元提</span>
							            	<input class="form-control money" type="number" min="0"/>
							            	<span class="input-group-addon money_span">元</span>
							            	<input class="form-control commission" type="number" min="0" style="display:none;"/>
							            	<span class="input-group-addon commission_span" style="display:none;">%</span>
						                </div>
					                </div>
				                </div>
			                
			                </fieldset>
		                </div>
		                
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-3 control-label"></label>
			                <input type="button" class="btn btn-primary" id="submit_button" value="保存">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/driverlevel/list';" value="返回">
			            </div>
					</form>
        		</div>
			</div>
		</div>
	</div>

	<div id="item-hour-div" style="display:none;">
		<#list 0..23 as t>
			<option value="${t}"><@padZero t /></option>
		</#list>
	</div>
	<div id="item-minute-div" style="display:none;">
		<#list 0..59 as t>
			<option value="${t}"><@padZero t /></option>
		</#list>
	</div>
	
</@override>
<@override name="footer">
<script src="${ctx}/assets/js/driverlevel2.js"></script>
<script type="text/javascript">
	<#if failureMessage??>
			$.scojs_message("${failureMessage}", $.scojs_message.TYPE_ERROR);
	</#if>
	$(document).ready(function(){
		
	});
</script>
</@override>
<@extends name="../layout.ftl"/>